package cn.doitedu.day03

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/*
 * 求差集
 */
object T13_SubtractDemo {

  def main(args: Array[String]): Unit = {

    //1.创建SparkConf
    val conf = new SparkConf().setAppName("WordCount")
      .setMaster("local[4]")
    val sc = new SparkContext(conf)

    val rdd1 = sc.parallelize(List("A", "B", "C", "A", "D", "E", "D"))
    val rdd2 = sc.parallelize(List("A", "B"))

    val rdd3: RDD[String] = rdd1.subtract(rdd2)
    //返回 C D E

    println(rdd3.collect().toBuffer)

  }
}
